<?php
namespace app\api\model;

use think\Model;

class TestUfhuikjl extends Model
{
    protected $deleteTime = 'delete_time';

    protected $table = 'ea_test_uf_huikjl';

    // 用户每月回款统计
    public function getSum($uid , $start , $end)
    {
        $where[] = ['hrmresource_id','=',$uid];
        $where[] = ['apply_month','>=',$start];
        $where[] = ['apply_month','<',$end];
        $where[] = ['delete_time','=',0];
        $res = self::where($where)->sum('jhhkje');
        return $res;
    }

    // 部门每月回款统计
    public function getDepartSum($departId , $start , $end)
    {
        $where[] = ['sqbm','=',$departId];
        $where[] = ['apply_month','>=',$start];
        $where[] = ['apply_month','<',$end];
        $where[] = ['delete_time','=',0];
        $res = self::where($where)->sum('jhhkje');
        return $res;
    }
}